home *** CD-ROM | disk | FTP | other *** search
- #include <Dialogs.h>
- #include <Memory.h>
- #include <Windows.h>
- #include <QuickDraw.h>
- #include <Fonts.h>
- #include <GestaltEQU.h>
- #include <Traps.h>
- #include <TextEdit.h>
- #include <OSUtils.h>
-
- #include "InitMac.h"
-
- #define TrapMask 0x0800
-
-
- /*\
- |*| ---------------------------------------------------------------------
- |*| GLOBALS
- |*| ---------------------------------------------------------------------
- \*/
- SysEnvRec TheWorld;
- Boolean WNE_available;
- Boolean HasGWorlds;
- Boolean HasCQD;
-
-
-
- /*\
- |*| ---------------------------------------------------------------------
- |*| NumToolboxTraps
- |*| ---------------------------------------------------------------------
- \*/
- short NumToolboxTraps (void)
- {
- if (NGetTrapAddress(_InitGraf, ToolTrap) ==
- NGetTrapAddress(0xAA6E, ToolTrap))
- return(0x0200);
- else
- return(0x0400);
- }
-
-
- /*\
- |*| ---------------------------------------------------------------------
- |*| GetTrapType
- |*| ---------------------------------------------------------------------
- \*/
- TrapType GetTrapType (short theTrap)
- {
- if ((theTrap & TrapMask) > 0)
- return(ToolTrap);
- else
- return(OSTrap);
- }
-
-
- /*\
- |*| ---------------------------------------------------------------------
- |*| TrapAvailable
- |*| ---------------------------------------------------------------------
- \*/
- Boolean TrapAvailable (short theTrap)
- {
-
- TrapType tType;
-
- tType = GetTrapType(theTrap);
- if (tType == ToolTrap)
- theTrap &= 0x07FF;
- if (theTrap >= NumToolboxTraps())
- theTrap = _Unimplemented;
-
- return (NGetTrapAddress(theTrap, tType) !=
- NGetTrapAddress(_Unimplemented, ToolTrap));
- }
-
-
- /*\
- |*| ---------------------------------------------------------------------
- |*| WNEAvailable
- |*| ---------------------------------------------------------------------
- \*/
- Boolean WNEAvailable (void)
- {
- return TrapAvailable(_WaitNextEvent);
- }
-
-
- /*\
- |*| ---------------------------------------------------------------------
- |*| CheckQuickDraw
- |*| ---------------------------------------------------------------------
- \*/
- void CheckQuickDraw (void)
- {
- long QDvers; /* Version of QuickDraw on this machine */
-
- /* Find out if GWorlds and CQD are implemented on this machine */
- Gestalt(gestaltQuickdrawVersion, &QDvers);
-
- HasGWorlds = (QDvers > gestaltOriginalQD && QDvers < gestalt8BitQD)
- || QDvers >= gestalt32BitQD;
-
- HasCQD = (QDvers >= gestalt8BitQD);
- }
-
-
- /*\
- |*| ---------------------------------------------------------------------
- |*| InitToolBox
- |*| ---------------------------------------------------------------------
- \*/
- void InitToolBox (short numberOfMasters)
- {
-
- InitGraf((Ptr) &qd.thePort);
- InitFonts();
- InitWindows();
- InitMenus();
- InitCursor();
- TEInit();
- FlushEvents(everyEvent, 0);
- InitDialogs(nil);
-
- while(numberOfMasters--)
- MoreMasters();
-
- MaxApplZone();
-
- SysEnvirons(1,&TheWorld);
-
- WNE_available = WNEAvailable();
-
- CheckQuickDraw ();
- }
-